import {Component, OnInit} from '@angular/core';
import {_HttpClient} from '@delon/theme';
import {UtilityService} from '../../../../service/utils.service';
import {NzModalService, NzNotificationService} from 'ng-zorro-antd';
import {ActivatedRoute, Router} from '@angular/router';
import {appConfig} from '../../../../service/common';

@Component({
  selector: 'app-entityauth',
  templateUrl: './entityauth.component.html',
})


export class EntityauthComponent implements OnInit {

    roleGuid: string;

    constructor(
        private http: _HttpClient,
        private router: Router,
        private activatedRoute: ActivatedRoute, // 注入路由，接收到参数
        private nznot: NzNotificationService,
        private utilityService: UtilityService,
    ) { }


    roleName: string;
    roleCode: string

    ngOnInit() {
        this.roleGuid = this.activatedRoute.snapshot.params.id; // 拿到父组件传过来的组织机构的guid来进行操作
        this.queryRoleData(this.roleGuid)
    }


    // 根据guid查询角色消息
    queryRoleData(id) {
        this.utilityService.getData(appConfig.serverUrl +  appConfig.API.queryRoleById + '/' + id)
            .subscribe(
                (val) => {
                    console.log(val)
                    this.roleName = val.result.roleName;
                    this.roleCode = val.result.roleCode;
                });
    }

}
